;
; SYSLIB Module Name:  SCCOUT
; Author:  Richard Conn
; SYSLIB Version Number:  2.0
; Module Version Number:  1.0
; Module Entry Points:
;	CCOUT
; Module External References:
;	COUT
;

;
;  CCOUT --
;	CONSOLE OUTPUT ROUTINE WITH CONTROL CHARACTER PROCESSING
;	OUTPUT CHAR IN REG A ON CON:
;	AFFECT NO REGISTERS OR FLAGS
;
	EXT	COUT

CCOUT::
	CPI	' '	; CHECK FOR LESS THAN <SP>
	JNC	COUT	; PROCESS NORMALLY IF EQUAL OR GREATER
;  TRAP OUT <NULL>, <BEL>, <BS>, <LF>, <CR>
	CPI	NULL	; <NULL>
	JZ	COUT
	CPI	BEL	; <BEL>
	JZ	COUT
	CPI	BS	; <BS>
	JZ	COUT
	CPI	LF	; <LF>
	JZ	COUT
	CPI	CR	; <CR>
	JZ	COUT
;  PRINT AS CTRL-CHAR
	PUSH	PSW	; SAVE A
	PUSH	PSW
	MVI	A,'^'	; PRINT UP ARROW
	CALL	COUT
	POP	PSW	; GET CHAR
	ADI	40H	; CONVERT TO CHAR
	CALL	COUT
	POP	PSW	; RESTORE A
	RET

;
;  ASCII SPECIAL CHARACTER EQUATES
;
NULL	EQU	 0	; NULL
BEL	EQU	 7	; BELL
BS	EQU	 8	; BACKSPACE
TAB	EQU	 9	; TAB
LF	EQU	10	; LINE FEED
CR	EQU	13	; CARRIAGE RETURN
CTRLR	EQU	'R'-40H	; CTRL-R
CTRLU	EQU	'U'-40H	; CTRL-U
CTRLX	EQU	'X'-40H	; CTRL-X
DEL	EQU	7FH	; DELETE CHAR

	END
